package com.ithuaxin.array;

import java.util.Random;

public class Test10 {
    public static void main(String[] args) {
        int arr[] = {1,2,3,4,5};
        int temp;
        Random random = new Random();
        for (int i = 0; i < arr.length; i++) {
            int randomindex = random.nextInt(arr.length);
            temp = arr [i];
            arr[i] = arr[randomindex];
            arr [randomindex] = temp;
        }
        for (int j = 0; j < arr.length; j++) {
            System.out.print(arr[j] + " ");
        }
    }
}
